/// @tags: DP

#include <cstdio>
#include <iostream>

using namespace std;

namespace BlueQuantum {

int constexpr N = 55, T = 2.5e3 + 5;

int n, m, t;
int f[N][T], g[N][N][T], sum[N][N];
char board[N][N];

inline int main() {
  cin >> n >> m >> t;
  for (int i = 1; i <= n; ++i) {
    cin >> (board[i] + 1);
    for (int j = 1; j <= m; ++j) {
      sum[i][j] = sum[i][j - 1] + (board[i][j] == '0');
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      for (int k = 1, klim = min(m, t); k <= klim; ++k) {
        for (int h = 0; h < j; ++h) {
          g[i][j][k] = max(
              g[i][j][k],
              g[i][h][k - 1] + max(sum[i][j] - sum[i][h], j - h - sum[i][j] + sum[i][h]));
        }
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= t; ++j) {
      for (int k = 0, klim = min(m, j); k <= klim; ++k) {
        f[i][j] = max(f[i][j], f[i - 1][j - k] + g[i][m][k]);
        ans = max(ans, f[i][j]);
      }
    }
  }
  cout << ans;
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("P4158 [SCOI2009] 粉刷匠.in", "r", stdin);
  freopen("P4158 [SCOI2009] 粉刷匠.out", "w", stdout);
#endif
#endif

  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
